#include"UdpServer.hpp"
#include<memory>
#include"log.hpp"
#include"Lock.hpp"
#include"dict.hpp"

//翻译函数：
std::string Hander(const std::string info)
{
    return "55";
}
using namespace USV;
int main(int argc,char* argv[])
{
    if(argc!=2)
    {
        std::cerr<<"Usage:"<<argv[0]<<"port"<<std::endl;
        return 1;
    }
    uint16_t port=std::stoi(argv[1]);

    dict my_dict;
    my_dict.Loaddict();

    std::unique_ptr<UdpServer> usvr=std::make_unique<UdpServer>(port,
        [&my_dict](std::string word)->std::string{
        return my_dict.Translate(word);
    });
    usvr->Init();
    usvr->Start();

    return 0;
}